package algorithm
{
	import struct.IComparable;

	public class DijkstraVertex implements IComparable
	{
		public var G:int;
		public var H:Number;
		public var x:int;
		public var y:int;
		public var pre:DijkstraVertex;
		public var searchNo:int;
		
		public function DijkstraVertex(x:int, y:int, distance:int)
		{
			this.x = x;
			this.y = y;
			this.G = distance;
		}
		
		public function get distance():Number {
			return G + H;
		}

		public function compare(v:IComparable):int {
			return this.distance - (v as DijkstraVertex).distance;
		}
		
		public function toString():String {
			return "x:" + x + " y:" + y + "G:" + G + " H:" + H + " d:" + distance;
		}
	}
}